#pragma once

#include "base/core/singleton.h"
#include "base/core/object_pool.h"
#include "ProtoBuffer/AllProtocol.h"
#include "Common/MessageDispatch/IMessageDispatch.h"
#include "Common/CharacterDefine.h"

class Player;

//逻辑服的竞技场管理器
class GArenaMgr : public IClientMessageHandler,
				  public IServerMessageHandler, 
				  public ManualSingleton<GArenaMgr>
	
{
public:
	bool 				Init();
	void 				UnInit();

	virtual void		onClientMessage(uint32_t actionId, RECV_PACKAGE &package, uint64_t Id = 0);
	virtual const char* getClientHandlerDebugInfo(void) { return "GArenaMgr::onClientMessage"; };

	virtual void		onServerMessage(uint32_t actionId, RECV_PACKAGE &package);
	virtual const char* getServerHandlerDebugInfo(void){ return "GArenaMgr::onServerMessage"; }

private:
	bool				OnArenaChallReq(CharIDType charId, RECV_PACKAGE &package);
	bool				OnArenaRankInfo(RECV_PACKAGE &package);
	bool				OnArenaRankChange(RECV_PACKAGE &package);

public:
	GArenaMgr();
	virtual ~GArenaMgr();
};

#define g_MakeGArenaMgr() (GArenaMgr::Instance())
#define g_GetGArenaMgr()  (GArenaMgr::GetInstance())
#define g_DelGArenaMgr()  (GArenaMgr::Destroy())